package com.whl.sm.controller.system;


import com.whl.sm.common.result.Result;
import com.whl.sm.service.system.MenuCpRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author wuhaolun
 * @since 2021-09-10
 */
@RestController
@RequestMapping("/menu-cp-role")
public class MenuCpRoleController {

    @Autowired
    MenuCpRoleService menuCpRoleService;

    @RequestMapping("/roleMenuInfo/{roleId}")
    public Result getMenuIdByRoleId(@PathVariable("roleId") String roleId){
        List<String> list = menuCpRoleService.getMenusByRelateRoleId(roleId);
        return Result.ok(list);
    }

    @RequestMapping("/edit/permMenu")
    public Result editRolePermMenu(@RequestParam String roleId,@RequestParam List<String> idList){
        menuCpRoleService.editRoleMenuInfo(roleId,idList);
        return Result.ok();
    }


}
